<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
        }

        #box {
            width: 200px;
            height: 200px;
            background-color: #ff3040;
            margin: 100px auto;
        }

        img {
            position: fixed;
        }
    </style>
</head>
<body>
<div id="box"></div>
<img src="images/tianshi.gif" alt="" id="pic">
<script>
    var pic = document.getElementById("pic");
    document.onclick = function (e) {
        e = e || window.event;
        pic.style.left = e.clientX-48 + "px";
        pic.style.top = e.clientY-40 + "px";
    }
</script>

</body>
</html>